<?php
$this->headTitle('Thành viên', 'append');
?>
<div class="dashboard-menu dashboard-admin">
    <span class="back">&nbsp;</span>
    <h1>Thành viên</h1>
    <?php if($this->acl->checkAllowed(array('moduleName'=>'admin','controllerName'=>'user','actionName'=>'add'))){ ?>
        <a class="btn btn-danger" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'add'));?>">
            Thêm mới
        </a>
    <?php } ?>
</div>
<div class="row placeholders">
    <div class="col-md-12">
        <div class="widget-big">
            <div class="table table-responsive">
                <div class="search-result text-left">
                    <table class="table table-bordetext-danger table-striped table-condensed table-hover" border="0" cellspacing="0" cellpadding="0">
                        <thead>
                            <tr class="warning">
                                <th>ID</th>
                                <th>Tên tài khoản</th>
                                <th>Quyền</th>
                                <th>Trạng thái</th>
                                <th>Chức năng</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
                                foreach ($this->userList as $user){
                            ?>
                            <tr>
                                <td><?php echo $user['adminId'];?></td>
                                <td>
                                    <?php if($this->acl->checkAllowed($this->auth,'admin','user','edit')){ ?>
                                        <a href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'edit', 'id'=>$user['adminId']));?>" title="Sửa thông tin người dùng">
                                            <?php echo $user['username']; ?>
                                        </a>
                                    <?php }else{ ?>
                                        <span class="blue"><?php echo $user['username']; ?></span>
                                    <?php } ?>
                                </td>
                                <td>
                                    <?php
                        				foreach($user['roleList'] as $role){
                        	                echo '- ',$role['roleName'],'</br>';
                        	            }
                                    ?>                   
                                </td>
                                <td>
                                    <?php
                                        if($user['status'] == 1){
                                            echo '<span class="active glyphicon glyphicon-ok" title="Enable"></span>';
                                        }else{
                                            echo '<span class="active glyphicon glyphicon-minus" title="Disable"></span>';
                                        }
                                    ?>
                                </td>
                                <td>
                                    
                                    <?php 
                                        
                                        if($this->acl->checkAllowed($this->auth,'admin','user','edit')){ ?>
                                        <a class="glyphicon glyphicon-pencil" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'edit', 'id'=>$user['adminId']));?>" title="Sửa thông tin">
                                            
                                        </a>&nbsp;&nbsp;
                                    <?php 
                                        }
                                        if($this->acl->checkAllowed($this->auth,'admin','user','delete')){
                                            if($this->userCheck['adminId'] != $user['adminId']){
                                    ?>
                                			<a class="glyphicon glyphicon-remove" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'user', 'action'=>'delete', 'id'=>$user['adminId']));?>" title="Xóa người dùng">
                                                
                                            </a>
                                    <?php 
                                            }
                                        } 
                                    ?>
                                </td>
                            </tr>
                            <?php
                                } 
                            ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>